home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group98b.txt / 000109_icon-group-sender _Mon Jun 29 08:41:51 1998.msg < prev    next >
Internet Message Format  |  2000-09-20  |  2KB

  1. Return-Path: <icon-group-sender>
  2. Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
  3.     by baskerville.CS.Arizona.EDU (8.8.8/8.8.7) with SMTP id IAA06745
  4.     for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Mon, 29 Jun 1998 08:41:51 -0700 (MST)
  5. Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
  6.     id AA29145; Mon, 29 Jun 1998 08:41:39 -0700
  7. Date: Sun, 28 Jun 1998 22:37:17 -0500
  8. Message-Id: <199806290337.WAA12295@segfault.cs.utsa.edu>
  9. From: Clinton Jeffery <jeffery@segfault.cs.utsa.edu>
  10. To: rwg@fns.com
  11. Cc: icon-group@optima.CS.Arizona.EDU
  12. In-Reply-To: <35970836.34465163@fns.com> (message from Robbie Gilbert on Sun,
  13.     28 Jun 1998 23:21:26 -0400)
  14. Subject: Re: Forcing Generator to Return a List of Values
  15. Reply-To: jeffery@segfault.cs.utsa.edu
  16. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  17. Status: RO
  18. Content-Length: 1299
  19.  
  20. [Robbie Gilbert provides a helper procedure and uses co-expression invocation
  21. p{} to solve his problem of turning a generator's result sequence into a list.]
  22.  
  23. Hi Robbie,
  24.  
  25. You've got some coding problems to fix, but when you fix them the general
  26. approach you describe will work and is attractively concise.  However, it is
  27. not cheap.  If you need to do this 10 times in your program, you have a
  28. great solution.  If you need to do it many thousands of times, you had best
  29. not create a new co-expression every time you capture a generator's results.
  30. The reason is that each co-expression requires substantial memory for its
  31. own stack, and the memory for co-expressions is not allocated and reclaimed
  32. in the same, efficient way that most Icon values are.
  33.  
  34. This is just my impression.  I am a big co-expression advocate and would
  35. welcome corrections and anecdotes from persons who have happily used
  36. thousands of co-expressions in a single program!
  37.  
  38. Remember, you are only going to save one line of code over:
  39.     L := []
  40.     every put(L, generator_expression)
  41.  
  42. Perhaps if you do an experiment and collect some timings, that will influence
  43. you!
  44.  
  45. Cheers,
  46.  
  47. Clint Jeffery, jeffery@cs.utsa.edu
  48. Division of Computer Science, The University of Texas at San Antonio
  49. Research http://www.cs.utsa.edu/research/plss.html
  50.